package cn.web.tunnelrobot.controller;

import cn.web.tunnelrobot.dao.ImageStatusDao;
import cn.web.tunnelrobot.dao.UserRecordDao;
import cn.web.tunnelrobot.dto.ImageInfoDTO;
import cn.web.tunnelrobot.dto.ImageStatusDTO;
import cn.web.tunnelrobot.pojo.UserRecord;
import cn.web.tunnelrobot.service.ImageInfoService;
import cn.web.tunnelrobot.service.UserRecordService;
import cn.web.tunnelrobot.util.*;
import cn.web.tunnelrobot.voice.RtcTokenBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Constant;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.*;
import static cn.web.tunnelrobot.util.TerminalControl.getTerminalControl;

/**
 * 实时控制
 *
 * @version 1.0.0
 */
@RestController
@RequestMapping("/realController")
@Api(tags = "实时控制")
@ApiSort(value = 7)
public class RealController {
    @Autowired
    private ImageInfoService imageInfoService;
    @Autowired
    private UserRecordService userRecordService;
    @Autowired
    private ImageStatusDao imageStatusDao;
    @Autowired
    private UserRecordDao userRecordDao;
    //获取用户session信息
    //HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    //User user = (User) request.getSession().getAttribute(Constants.USER_SESSION);

    //log4j
    Logger logger = LoggerFactory.getLogger(RealController.class);
    private static final Set<String> IMAGE_SUFFIX_SET = new HashSet<String>(Arrays.asList("mp4"));
    private static Integer flag;//标记左转还是右转

    @PostMapping("/upload")
    @ResponseBody
    @ApiOperation(value = "文件路径", notes = "上传文件")
    public HashMap<String, Object> upload(@RequestParam(value = "file") MultipartFile file) {
        HashMap<String, Object> map = new HashMap<String, Object>();
        if (file.isEmpty()) {
            map.put("code", -1);
            map.put("msg", "文件不能为空");
            return map;
        }
        int lastIndex = file.getOriginalFilename().lastIndexOf('.');
        if (lastIndex == -1) {
            map.put("code", -1);
            map.put("msg", "文件名称错误，缺失文件后缀");
            return map;
        }
        String suffix1 = file.getOriginalFilename().substring(lastIndex + 1);
        if (StringUtils.isEmpty(suffix1)) {
            map.put("code", -1);
            map.put("msg", "文件名称错误，缺失文件后缀");
            return map;
        }
        if (!IMAGE_SUFFIX_SET.contains(suffix1)) {
            map.put("code", -1);
            map.put("msg", "文件格式不支持，仅支持视频类(mp4)格式");
            return map;
        }
        String url = UploadImage.upLoadVideoFile(file);
        logger.info("视频文件地址:" + url);
        map.put("date", url);
        map.put("code", 0);
        return map;
    }

    @GetMapping("/collectPictureInfo")
    @ResponseBody
    @ApiOperation(value = "无", notes = "采集图像")
    public HashMap<String, Object> collectPictureInfo() {
        HashMap<String, Object> map = new HashMap<>();
        final ExecutorService exec = Executors.newFixedThreadPool(1);//创建线程
        Callable<String> call = new Callable<String>() {
            public String call() {
                //开始执行耗时操作
//                String url =  Constants.getsRealMonitoringAddress.get(4);
                String url = Constants.doGet(Constants.captureImg);
                System.out.println("url:" + url);
                String urlHttp = url.substring(0, 4);
                logger.info("urlHttp:" + urlHttp);
                if (!urlHttp.equals("http")) {
                    map.put("code", -1);
                    map.put("msg", "采集信息时出错");
                }
                if (!StringUtils.isEmpty(url)) {
                    map.put("code", 0);
                    map.put("url", url);
                    //查询所有的状态信息
                    List<ImageStatusDTO> imageStatusList = imageStatusDao.getImageStatusList();
                    map.put("imageStatusList", imageStatusList);
                    //上下部分
                    List<ImageStatusDTO> constructionStatus = new ArrayList<>();
                    for (int i = 0; i < 2; i++) {
                        ImageStatusDTO imageStatusDTO = new ImageStatusDTO();
                        if (i == 0) {
                            imageStatusDTO.setIsId(1);
                            imageStatusDTO.setIsName("上半部分");
                        } else if (i == 1) {
                            imageStatusDTO.setIsId(2);
                            imageStatusDTO.setIsName("下半部分");
                        }
                        constructionStatus.add(imageStatusDTO);
                    }
                    //施工状态1上
                    List<ImageStatusDTO> constructionStatus1 = new ArrayList<>();
                    for (int i = 0; i < 4; i++) {
                        ImageStatusDTO imageStatusDTO = new ImageStatusDTO();
                        if (i == 0) {
                            imageStatusDTO.setIsId(1);
                            imageStatusDTO.setIsName("开挖");
                        } else if (i == 1) {
                            imageStatusDTO.setIsId(2);
                            imageStatusDTO.setIsName("初支");
                        } else if (i == 2) {
                            imageStatusDTO.setIsId(3);
                            imageStatusDTO.setIsName("二衬");
                        } else if (i == 3) {
                            imageStatusDTO.setIsId(4);
                            imageStatusDTO.setIsName("已完成");
                        }
                        constructionStatus1.add(imageStatusDTO);
                    }
                    //施工状态2下
                    List<ImageStatusDTO> constructionStatus2 = new ArrayList<>();
                    for (int i = 0; i < 2; i++) {
                        ImageStatusDTO imageStatusDTO2 = new ImageStatusDTO();
                        if (i == 0) {
                            imageStatusDTO2.setIsId(1);
                            imageStatusDTO2.setIsName("仰拱");
                        } else if (i == 1) {
                            imageStatusDTO2.setIsId(2);
                            imageStatusDTO2.setIsName("已完成");
                        }
                        constructionStatus2.add(imageStatusDTO2);
                    }
                    map.put("constructionStatusList", constructionStatus);
                    map.put("constructionStatusList1", constructionStatus1);
                    map.put("constructionStatusList2", constructionStatus2);
                }
                return "线程执行完成.";
            }
        };
        try {
            Future<String> future = exec.submit(call);
            String obj = future.get(1000 * 5, TimeUnit.MILLISECONDS); //任务处理超时时间设为 1 秒
            logger.info("任务成功返回:" + obj);
        } catch (Exception e) {
            map.put("code", -1);
            map.put("msg", "采集信息时出错");
            logger.info("处理失败.");
            e.printStackTrace();
        }
        // 关闭线程池
        exec.shutdown();
        return map;
    }

    @GetMapping("/getMonitorScreen")
    @ResponseBody
    @ApiOperation(value = "boundary", notes = "获取实时监控")
    public HashMap<String, Object> getMonitorScreen(@RequestParam Integer boundary) {
        HashMap<String, Object> map = new HashMap<>();
        final ExecutorService exec = Executors.newFixedThreadPool(1);//创建线程
        Callable<String> call = new Callable<String>() {
            public String call() {
                logger.info("获取实时监控画面接口getMonitorScreen:" + String.valueOf(boundary - 1));
                //开始执行耗时操作
                String value = Constants.getsRealMonitoringAddress.get(boundary - 1);
                logger.info("获取监控画面地址:" + value);
                if (value.substring(0, 4).equals("http")) {
                    map.put("code", 0);
                    map.put("data", value);
                    map.put("msg", "获取成功");
                } else {
                    map.put("code", -1);
                    map.put("msg", "获取出错");
                }
                return "线程执行完成.";
            }
        };
        try {
            Future<String> future = exec.submit(call);
            String obj = future.get(1000 * 5, TimeUnit.MILLISECONDS);
            logger.info("任务成功返回:" + obj);
        } catch (Exception e) {
            map.put("code", -1);
            map.put("msg", "请求超时");
            logger.info("监控画面请求超时!!!!");
            logger.info(e.getMessage());
            //e.printStackTrace();
        }
        // 关闭线程池
        exec.shutdown();
        return map;
    }
    /**
     * 添加视频信息（二期）
     * gbq
     */
    @PostMapping("/addVideoInfo")
    @ResponseBody
    @ApiOperation(value = "type，imageInfoDTO", notes = "添加录像信息")
    public HashMap<String, Object> addVideoInfo(@RequestParam Integer type, @RequestBody ImageInfoDTO imageInfoDTO) {
        if (type == 1) {
            String url = imageInfoDTO.getImVideoAddress();
            logger.info("文件上传地址:" + url);
          /*  //获取硬件传输的url
            if (!StringUtils.isEmpty(url)) {
                String imageName = new Date().getTime() + ".mp4";//设置文件名
                String urls = UploadImage.imagePath + imageName;//设置文件名
                String path = UploadImage.imageDir + imageName;//文件下载路径
                UploadImage.downloadVideo(url, path);//文件下载保存
                logger.info("imageName:" + imageName);
                logger.info("urls:" + urls);
                imageInfoDTO.setImVideoAddress(urls);
            } else {
                logger.info("addImageInfo硬件传输的url:null");
            }*/
        } else if (type == 2) {
            //方式2 通过上传形式保存信息
        }
        //判断里程是不是数字型
        boolean flag = MileageConversion.isNumeric(imageInfoDTO.getImMileage());
        if (flag == false) {
            int dist = MileageConversion.distance(imageInfoDTO.getImMileage());
            String dists = String.valueOf(dist);
            imageInfoDTO.setImMileage(dists);
        }
        imageInfoDTO.setImCreateDate(new Date());
        return imageInfoService.addImageInfo(imageInfoDTO);
    }


    @PostMapping("/addImageInfo")
    @ResponseBody
    @ApiOperation(value = "imageInfoDTO", notes = "添加抓拍信息")
    public HashMap<String, Object> addImageInfo(@RequestParam Integer type, @RequestBody ImageInfoDTO imageInfoDTO) {
        if (type == 1) {
            String url = imageInfoDTO.getImVideoAddress();
            logger.info("addImageInfo接口获取硬件抓拍的url:" + url);
            // 获取硬件传输的url
            if (!StringUtils.isEmpty(url)) {
                // Replace all occurrences of "\" with "/"
                url = url.replaceAll("\\\\", "/");
                String imageName = new Date().getTime() + new Random().nextInt(10000) + ".png";// 设置文件名
                String urls = UploadImage.imagePath + imageName;// 设置文件名
                String path = UploadImage.imageDir + imageName;// 文件下载路径
                UploadImage.downloadPicture(url, path);// 文件下载保存
                logger.info("imageName:" + imageName);
                logger.info("urls:" + urls);
                    imageInfoDTO.setImVideoAddress(urls);
            } else {
                logger.info("addImageInfo硬件传输的url:null");
            }
        } else if (type == 2) {
            String url = imageInfoDTO.getImVideoAddress();
            logger.info("addImageInfo接口获取硬件抓拍的url:" + url);
        }
        // 判断里程是不是数字型
        boolean flag = MileageConversion.isNumeric(imageInfoDTO.getImMileage());
        if (!flag) {
            int dist = MileageConversion.distance(imageInfoDTO.getImMileage());
            String dists = String.valueOf(dist);
            imageInfoDTO.setImMileage(dists);
        }
        imageInfoDTO.setImCreateDate(new Date());
        return imageInfoService.addImageInfo(imageInfoDTO);
    }


    private static int stop = 0;//注：按下急停后，必须先按启动才可以按前进或者后退等，禁止不按启动，直接按前进或后退后再按启动。按启动后，车轮默认不动。

    @GetMapping("/carBodyControl")//缺少急停，ipad，机器端控制得判断
    @ResponseBody
    @ApiOperation(value = "底盘控制",notes="speed_y =0")
    public HashMap<String, Object> carBodyControl(@RequestParam(required = true)  float speed_x,
                                                  @RequestParam(required = true)  float speed_y,
                                                  @RequestParam(required = true)  float speed_angle,
                                                  @RequestParam(required = true)  String  userid) {

        HashMap<String, Object> map = new HashMap<>();
        String value;
        try {
            if (speed_angle > 0.1) {
                Constants.doGet(Constants.carTurnLight +
                        "?type=" + 1 + "&bool=" + true);
                value=Constants.doPut(Constants.carBodyControl+"?speed_x="+
                        speed_x + "&speed_y=" +
                        speed_y + "&speed_angle=" +
                        speed_angle);
                        flag = 1;
            }else if (speed_angle < -0.1) {
                    Constants.doGet(Constants.carTurnLight + "?type=" + 2 + "&bool=" + true);
                   value= Constants.doPut(Constants.carBodyControl + "?speed_x=" +
                            speed_x + "&speed_y=" +
                            speed_y + "&speed_angle=" +
                            speed_angle);
                    flag=2;
                    } else{
                       value= Constants.doPut(Constants.carBodyControl + "?speed_x=" +
                                speed_x + "&speed_y=" +
                                speed_y + "&speed_angle=" +
                                speed_angle);
                        }
            if(flag != null) {
                Thread.sleep(5000);
                Constants.doGet(Constants.carTurnLight + "?type=" + flag + "&bool=" + false);
            }
            if(value.contains("获取成功")){
                map.put("code", 0);
                map.put("msg", "控制成功");
            }
        } catch (Exception e) {
            map.put("code", -1);
            map.put("msg", "控制失败");
            e.printStackTrace();
        }
        UserRecord userRecord=new UserRecord();
        String name="";
        if(speed_angle > 0.1){
            name="左转";
        } else if (speed_angle < -0.1) {
            name="右转";
        } else {
            if(speed_x>0){
                name="前进";
            }else {
                name="后退";
            }
        }
        userRecord.setUrOperatContent(name+(map.get("msg")).toString());
        Integer i = Integer.valueOf(userid);
        userRecord.setUsId(i);
        userRecord.setUrOperatRobot(1);
        userRecordService.addUserRecord(userRecord);
        return map;
    }

    @GetMapping("/manipulatorControl")
    @ResponseBody
    public HashMap<String, Object> manipulatorControl(@RequestParam Integer direction,
                                                      @RequestParam Integer terminal) {
        HashMap<String, Object> map = new HashMap<>();
        logger.info("机械臂控制:" + direction);
        logger.info("机械臂控制:" + direction);
        logger.info("机械臂控制:" + direction);
        //开始执行耗时操作
        String value = "";

        String direName = "";
        if (Constants.TerminalControl == terminal) {
            if (direction == 6 || direction == 9 || direction == 12 || direction == 15) {
                Constants.TerminalControl = 0;
            }
        }
        if (Constants.TerminalControl != 0) {
            String terminalControl = getTerminalControl(Constants.TerminalControl);
            map.put("code", -1);
            map.put("msg", terminalControl);
            return map;
        }
        switch (direction) {
            /*case 1 :direName = "大臂伸出";value = Constants.doGet(Constants.manipulatorControl + "?flag1="+1+"&flag0="+2);break;
            case 2 :direName = "大臂缩回";value = Constants.doGet(Constants.manipulatorControl + "?flag1="+1+"&flag0="+3);break;
            case 3 :direName = "大臂停止";value = Constants.doGet(Constants.manipulatorControl + "?flag1="+1+"&flag0="+1);break;*/

            case 4:
                direName = "中臂伸出";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 2 + "&flag0=" + 2);
                break;
            case 5:
                direName = "中臂缩回";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 2 + "&flag0=" + 3);
                break;
            case 6:
                direName = "中臂停止";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 2 + "&flag0=" + 1);
                break;

            case 7:
                direName = "伸缩臂伸出";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 3 + "&flag0=" + 2);
                break;
            case 8:
                direName = "伸缩臂缩回";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 3 + "&flag0=" + 3);
                break;
            case 9:
                direName = "伸缩臂停止";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 3 + "&flag0=" + 1);
                break;

            case 10:
                direName = "顶臂伸出";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 4 + "&flag0=" + 2);
                break;
            case 11:
                direName = "顶臂缩回";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 4 + "&flag0=" + 3);
                break;
            case 12:
                direName = "顶臂停止";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 4 + "&flag0=" + 1);
                break;

            case 13:
                direName = "雷达伸出";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 5 + "&flag0=" + 2);
                break;
            case 14:
                direName = "雷达缩回";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 5 + "&flag0=" + 3);
                break;
            case 15:
                direName = "雷达停止";
                value = Constants.doGet(Constants.manipulatorControl + "?flag1=" + 5 + "&flag0=" + 1);
                break;
        }
        logger.info("机械臂控制:" + value);
        if (value.equals("success")) {
            if (direction != 6 && direction != 9 && direction != 12 && direction != 15) {
                Constants.TerminalControl = terminal;
            }
            map.put("code", 0);
            map.put("msg", "控制成功");
            /*UserRecord userRecord = new UserRecord();
            userRecord.setUsId(user.getUsId());
            userRecord.setUrOperatContent("控制机械臂"+direName);
            userRecord.setUrOperatTime(new Date());
            userRecordDao.addUserRecord(userRecord);*/
        } else {
            Constants.TerminalControl = 0;
            map.put("code", -1);
            map.put("msg", "控制出错");
        }
        return map;
    }
    /**
     * 机械臂控制（二期）
     * gbq
     */
    @GetMapping("/robotArmControl")
    @ResponseBody
    public HashMap<String, Object> robotArmControl(HttpServletRequest request,
                                                   @ApiParam("左右臂") @RequestParam Integer direction ,
                                                   @ApiParam("大臂J1") @RequestParam Integer j1,
                                                   @ApiParam("中臂J2") @RequestParam Integer j2,
                                                   @ApiParam("小臂J3") @RequestParam Integer j3
    ){
        HashMap<String, Object> map = new HashMap<>();
        logger.info("机械臂控制:" + direction);
        String value = "";
        String direName = "";
        switch(direction){
            case 0 :direName = "左臂控制";value = Constants.doGet(Constants.armControl + "?left_jone="+j1+"&left_jtwo="+j2+"&left_jthree="+j3+ "?right_jfour="+0+"&right_jfive="+0+"&right_jsix="+0);break;
            case 1 :direName = "右臂控制";value = Constants.doGet(Constants.armControl + "?left_jone="+0+"&left_jtwo="+0+"&left_jthree="+0+"?right_jfour="+j1+"&right_jfive="+j2+"&right_jsix="+j3);break;
        }
        logger.info("机械臂控制:" + value);
        if (value.equals("success")){
            map.put("code", 0);
            map.put("msg", "控制成功");
        }else {
            map.put("code", -1);
            map.put("msg", "控制出错");
        }
        return map;
    }
    /**
     * 机械臂复位
     * gbq
     */
    @GetMapping("/robotArmRest")
    @ResponseBody
    public HashMap<String, Object> robotArmRest(){
        HashMap<String, Object> map = new HashMap<>();
        String value = "";
        value = Constants.doGet(Constants.robotArmRest);
        if (value.equals("success")){
            map.put("code", 0);
            map.put("msg", "复位成功");
        }else{
            map.put("code", -1);
            map.put("msg", value);
        }
        return map;
    }

    @GetMapping("/cloudPlatformShift")
    @ResponseBody
    public HashMap<String, Object> cloudPlatformShift(@RequestParam Integer type, @RequestParam Integer direction, @RequestParam Integer turn,
                                                      @RequestParam Integer terminal) {
        HashMap<String, Object> map = new HashMap<>();
        try {
            if (type == 1) {
                //开始执行耗时操作
                String value = Constants.doPost(Constants.taiwanStart, "type=" + direction + "&speed=" + turn);
                logger.info("云平台转向控制开始:" + value);
                if (value.equals("success")) {
//                    Constants.TerminalControl = terminal;
                    map.put("code", 0);
                    map.put("msg", "控制成功");
                    String direName = "";
                    switch (direction) {
                        case 0:
                            direName = "上";
                            break;
                        case 1:
                            direName = "下";
                            break;
                        case 2:
                            direName = "左";
                            break;
                        case 3:
                            direName = "右";
                            break;
                        case 4:
                            direName = "左上";
                            break;
                        case 5:
                            direName = "左下";
                            break;
                        case 6:
                            direName = "右上";
                            break;
                        case 7:
                            direName = "右下";
                            break;
                        case 8:
                            direName = "放大";
                            break;
                        case 9:
                            direName = "缩小";
                            break;
                        case 10:
                            direName = "近焦距";
                            break;
                        case 11:
                            direName = "远焦距";
                            break;
                    }
                    String turns = "";
                    if (turn == 1) {
                        turns = "适中";
                    } else if (turn == 2) {
                        turns = "快";
                    }
                        /*UserRecord userRecord = new UserRecord();
                        userRecord.setUsId(user.getUsId());
                        userRecord.setUrOperatContent("云平台转向控制："+direName+",控制转速："+turns);
                        userRecord.setUrOperatTime(new Date());
                        userRecordDao.addUserRecord(userRecord);*/
                } else {
                    map.put("code", -1);
                    map.put("msg", "控制出错");
                }
            } else {//暂停云平台转向
                //开始执行耗时操作
                String value = Constants.doPost(Constants.taiwanStop, "flag=" + direction);
                logger.info("云平台转向控制结束:" + value);
                if (value.equals("success")) {
                    map.put("code", 0);
                    map.put("msg", "控制成功");
                } else {
                    map.put("code", -1);
                    map.put("msg", "控制出错");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            map.put("code", -1);
            map.put("msg", "控制出错");
        }
        return map;
    }

    @GetMapping("/voiceControl")
    @ResponseBody
    public HashMap<String, Object> voiceControl(@RequestParam Integer control) {
        HashMap<String, Object> map = new HashMap<>();
        if (control == 1 || control == 2) {
            if (control == Constants.voiceControl) {
                map.put("code", -1);
                map.put("msg", "连接失败,机器人正在语音中");
            } else {
                Constants.voiceControl = control;
                logger.info("语音控制传入值control(1开始 2暂停):" + control);
                logger.info("语音控制传入值voiceControl:" + control);
                if (control == 1) {
                    map.put("code", 0);
                    map.put("msg", "连接成功");
                } else {
                    map.put("code", 0);
                    map.put("msg", "结束对讲");
                }
                //第一次请求
                //UserRecord userRecord = new UserRecord();
                //userRecord.setUsId(user.getUsId());
                if (control == 1) {
                    Constants.connection = 1;
                    // userRecord.setUrOperatContent("控制机器人进行语音对讲功能");
                } else if (control == 2) {
                    Constants.shutDown = 1;
                    //userRecord.setUrOperatContent("控制机器人暂停语音对讲功能");
                }
                //userRecord.setUrOperatTime(new Date());
                //userRecordDao.addUserRecord(userRecord);
            }
        } else {
            map.put("code", -1);
            map.put("msg", "请求超时");
        }
        return map;
    }

    @PostMapping("/filesBroadcast")
    @ResponseBody
    public HashMap<String, Object> filesBroadcast(@RequestParam(value = "file") MultipartFile file) {
        HashMap<String, Object> map = new HashMap<>();
        final ExecutorService exec = Executors.newFixedThreadPool(1);//创建线程
        String wordUrl = UploadImage.upLoadFiles(file);//上传文件
        logger.info("文件地址原始:" + wordUrl);
        logger.info(wordUrl.substring(13, wordUrl.length()));
        wordUrl = wordUrl.substring(13, wordUrl.length());
        logger.info("文件地址截取:" + wordUrl);
        logger.info("--------------------:" + UploadImage.imageDir + wordUrl);
        String result = ReadWordContent.ReadDoc(UploadImage.imageDir + wordUrl);
        if (result == "-1") {
            map.put("code", -1);
            map.put("msg", "此文件不是word文件");
            return map;
        } else if (result == "-2") {
            map.put("code", -1);
            map.put("msg", "提取word文字出错");
            return map;
        } else if (StringUtils.isEmpty(result)) {
            map.put("code", -1);
            map.put("msg", "文件为空");
            return map;
        } else {
            Callable<String> call = new Callable<String>() {
                public String call() {
                    //开始执行耗时操作
                    String value = null;
                    try {
                        System.out.println("result:" + result);
                        value = Constants.doPost(Constants.voiceBroadcast, "content=" + result);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if (value.equals("success")) {
                        logger.info("word语音播放成功");
                        map.put("code", 0);
                        map.put("msg", "word语音播放成功");
                    /*UserRecord userRecord = new UserRecord();
                    userRecord.setUsId(user.getUsId());
                    userRecord.setUrOperatContent("控制车体"+direName);
                    userRecord.setUrOperatTime(new Date());
                    userRecordDao.addUserRecord(userRecord);*/
                    } else {
                        map.put("code", -1);
                        map.put("msg", "播语音报出错");
                    }
                    return "线程执行完成.";
                }
            };
            try {
                Future<String> future = exec.submit(call);
                String obj = future.get(1000 * 30, TimeUnit.MILLISECONDS);
                logger.info("任务成功返回:" + obj);
            } catch (Exception e) {
                map.put("code", -1);
                map.put("msg", "请求超时");
                logger.info("请求超时.");
                e.printStackTrace();
            }
            // 关闭线程池
            exec.shutdown();
            map.put("code", 0);
            map.put("msg", "word语音播放成功");
        }
        return map;
    }

    static String appId = "6e808c6dbb3c469388bdcf5c531dacc0";
    static String appCertificate = "27f6f0a5173344caa4113b51a3e352c3";
    static String channelName = "1000";
    static int uid = 0;
    static int expirationTimeInSeconds = 3600;
    //获取的token值
    static String tokenValue = "";

    @GetMapping("/getClientVoiceToken")
    @ResponseBody
    public HashMap<String, Object> getClientVoiceToken() {
        HashMap<String, Object> map = new HashMap<>();
        try {
            RtcTokenBuilder token = new RtcTokenBuilder();
            int timestamp = (int) (System.currentTimeMillis() / 1000 + expirationTimeInSeconds);
            String result = token.buildTokenWithUid(appId, appCertificate, channelName, uid, RtcTokenBuilder.Role.Role_Publisher, timestamp);
            logger.info("token获取值:" + result);
            if (StringUtils.isNotEmpty(result)) {
                tokenValue = result;
                map.put("code", 0);
                map.put("data", result);
            } else {
                map.put("code", -1);
                map.put("msg", "获取失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            map.put("code", -1);
            map.put("msg", "获取失败");
        }
        return map;
    }

    @GetMapping("/getRobotVoiceToken")
    @ResponseBody
    public HashMap<String, Object> getRobotVoiceToken() {
        HashMap<String, Object> map = new HashMap<>();
        if (StringUtils.isNotEmpty(tokenValue)) {
            map.put("code", 0);
            map.put("data", tokenValue);
        } else {
            map.put("code", -1);
            map.put("msg", "获取失败");
        }
        return map;
    }

    /**
     * 前后车灯控制（二期）
     * lbh
     */
    @GetMapping("/carBodyLightControl")
    @ResponseBody
    @ApiOperation(value = "车灯实时控制", notes = "1.前车灯 2.后车灯 3.所有灯")
    public HashMap<String, Object> carBodyLightControl(
            HttpSession session,
            @ApiParam("车灯类型") @RequestParam int type,
            @ApiParam("是否开启") @RequestParam boolean control,
            @RequestParam String userid) {
        HashMap<String, Object> map = new HashMap<>();
        String flag;
        try {
            String value = Constants.doGet(Constants.carBodyLight + "?type=" + type + "&bool=" + control);
            logger.info("前后车灯控制结束:" + value);
            switch (type) {
                case 1:
                    flag = "前车灯";
                    break;
                case 2:
                    flag = "后车灯";
                    break;
                case 3:
                    flag = "所有灯";
                    break;
                default:
                    flag = "出错了，输入";
            }
            if (value.equals("success")) {
                map.put("code", 0);
                map.put("msg", "控制" + "成功");
            } else {
                map.put("code", -1);
                map.put("msg", "控制"  + "失败");
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            map.put("code", -1);
            map.put("msg", "控制出错，请重试");
        }
        UserRecord userRecord = new UserRecord();
        String name = "";
        if (type == 1) {
            name = "前车灯";
        } else if (type == 2) {
            name = "后车灯";
        } else if (type == 3) {
            name = "所有车灯";
        }
        userRecord.setUrOperatContent(name + (map.get("msg")).toString());
        Integer i = Integer.valueOf(userid);
        userRecord.setUsId(i);
        userRecord.setUrOperatRobot(1);
        userRecordService.addUserRecord(userRecord);
        return map;
    }
//        try {
//            //开始执行耗时操作
//            String value = Constants.doGet(Constants.headlights + "?flag=" + light + "&bool=" + control);
//            logger.info("车灯/报警灯控制结束:" + value);
//            if (value.equals("success")) {
//                map.put("code", 0);
//                map.put("msg", "控制成功");
//            }else{
//                map.put("code", -1);
//                map.put("msg", "控制出错");
//            }
            /*UserRecord userRecord = new UserRecord();
            userRecord.setUsId(user.getUsId());
            if(light==1){
                if(control==true){
                    userRecord.setUrOperatContent("机器人报警灯开启");
                }else{
                    userRecord.setUrOperatContent("机器人报警灯关闭");
                }
            }else if(light==2){
                if(control==true){
                    userRecord.setUrOperatContent("机器人车灯开启");
                }else{
                    userRecord.setUrOperatContent("机器人车灯关闭");
                }
            }
            userRecord.setUrOperatTime(new Date());
           userRecordDao.addUserRecord(userRecord);*/
//        } catch (Exception e) {
//            e.printStackTrace();
//            map.put("code", -1);
//            map.put("msg", "控制出错");
//        }
//        return map;
//    }

    /**
     * 警报灯控制（二期）
     * lbh
     */
    @GetMapping("carAlarmLightControl")
    @ResponseBody
    @ApiOperation(value = "control", notes = "警报灯控制（二期）")
    public HashMap<String, Object> carAlarmLightControl(
            @ApiParam("是否开启") @RequestParam boolean control,
                                @RequestParam String userid ) {
        HashMap<String, Object> map = new HashMap<>();
        try {
            String value = Constants.doGet(Constants.carAlarmLight + "?bool=" + control);
            if (value.equals("success")) {
                map.put("code", 0);
                map.put("msg", "控制成功");
            } else{
                map.put("code", -1);
                map.put("msg", "报警音播放失败!");
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            map.put("code", -1);
            map.put("msg", "控制失败，请联系管理员检查硬件！");
        }
        UserRecord userRecord = new UserRecord();
        String name = "警报灯";
        userRecord.setUrOperatContent(name + (map.get("msg")).toString());
        Integer i = Integer.valueOf(userid);
        userRecord.setUsId(i);
        userRecord.setUrOperatRobot(1);
        userRecordService.addUserRecord(userRecord);
        return map;
    }

    /**
     * 避障控制
     * gbq
     */
    @PostMapping("carObstacleControl")
    @ResponseBody
    @ApiOperation(value = "control", notes = "避障控制")
    public HashMap<String, Object> carObstacleControl(Integer userid)
    {
        HashMap<String, Object> map = new HashMap<>();
        try {
            if(Constants.obstacleStatus==0){
                Constants.obstacleStatus=1;
                logger.info("避障打开");
                map.put("code", 0);
                map.put("msg", "避障打开成功");
            }else {
                Constants.obstacleStatus=0;
                logger.info("避障关闭");
                map.put("code", -1);
                map.put("msg", "避障关闭成功");
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            map.put("code", -1);
            map.put("msg", "避障出错");
        }
        UserRecord userRecord = new UserRecord();
        userRecord.setUrOperatContent((map.get("msg")).toString());
        userRecord.setUsId(userid);
        userRecord.setUrOperatRobot(1);
        userRecordService.addUserRecord(userRecord);
        return map;
    }

    /**
     * 转向灯控制（二期）
     * lbh
     */
    @GetMapping("carTurnLightsControl")
    @ResponseBody
    @ApiOperation(value = "control", notes = "转向灯控制（二期）")
    public HashMap<String, Object> carTurnLightsControl(
            @ApiParam("车灯类型") @RequestParam Integer type,
            @ApiParam("是否开启") @RequestParam boolean control) {
        HashMap<String, Object> map = new HashMap<>();
        try {
            String value = Constants.doGet(Constants.carTurnLight + "?type=" + type + "&bool=" + control);
            logger.info("转向灯灯控制结束:" + value);
            if (value.equals("success")) {
                map.put("code", 0);
                map.put("msg", "控制成功");
            } else {
                map.put("code", -1);
                map.put("msg", "控制失败");
            }
        } catch (Exception exception) {
            exception.printStackTrace();
            map.put("code", -1);
            map.put("msg", "控制转向灯出错，请重试");
        }
        UserRecord userRecord = new UserRecord();
        String name = "";
        if (type == 1) {
            name = "左转向灯";
        } else if (type == 2) {
            name = "右转向灯";
        }
        userRecord.setUrOperatContent(name + (map.get("msg")).toString());
        userRecord.setUsId(uid);
        userRecord.setUrOperatRobot(1);
        userRecordService.addUserRecord(userRecord);
        return map;
    }

    /**
     * 机械臂臂灯控制（二期）
     * lbh
     */
    @GetMapping("/ArmLightsControl")
    @ApiOperation(value = "机械臂臂灯控制")
    public HashMap<String, Object> ArmLightsControl(Boolean bool) {
        HashMap<String, Object> map = new HashMap<>();
        try {
            String result = Constants.doGet(Constants.carArmLight + "?bool=" + bool);
            if (result.contains("success")) {
                map.put("code", 0);
                map.put("msg", "控制成功");
            } else {
                map.put("code", -1);
                map.put("msg", "控制失败");
            }
        } catch (Exception e) {
            map.put("code", -1);
            map.put("msg", "无法控制手部机械臂灯，请联系管理员检查硬件！");
        }
        return map;
    }

    @GetMapping("/collectVideoInfo")
    @ResponseBody
    public HashMap<String, Object> collectVideoInfo() {
        HashMap<String, Object> map = new HashMap<>();
        //查询所有的状态信息
        List<ImageStatusDTO> imageStatusList = imageStatusDao.getImageStatusList();
        map.put("imageStatusList", imageStatusList);
        //上下部分
        List<ImageStatusDTO> constructionStatus = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            ImageStatusDTO imageStatusDTO = new ImageStatusDTO();
            if (i == 0) {
                imageStatusDTO.setIsId(1);
                imageStatusDTO.setIsName("上半部分");
            } else if (i == 1) {
                imageStatusDTO.setIsId(2);
                imageStatusDTO.setIsName("下半部分");
            }
            constructionStatus.add(imageStatusDTO);
        }
        //施工状态1上
        List<ImageStatusDTO> constructionStatus1 = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            ImageStatusDTO imageStatusDTO = new ImageStatusDTO();
            if (i == 0) {
                imageStatusDTO.setIsId(1);
                imageStatusDTO.setIsName("开挖");
            } else if (i == 1) {
                imageStatusDTO.setIsId(2);
                imageStatusDTO.setIsName("初支");
            } else if (i == 2) {
                imageStatusDTO.setIsId(3);
                imageStatusDTO.setIsName("二衬");
            } else if (i == 3) {
                imageStatusDTO.setIsId(4);
                imageStatusDTO.setIsName("已完成");
            }
            constructionStatus1.add(imageStatusDTO);
        }
        //施工状态2下
        List<ImageStatusDTO> constructionStatus2 = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            ImageStatusDTO imageStatusDTO2 = new ImageStatusDTO();
            if (i == 0) {
                imageStatusDTO2.setIsId(1);
                imageStatusDTO2.setIsName("仰拱");
            } else if (i == 1) {
                imageStatusDTO2.setIsId(2);
                imageStatusDTO2.setIsName("已完成");
            }
            constructionStatus2.add(imageStatusDTO2);
        }
        map.put("constructionStatusList", constructionStatus);
        map.put("constructionStatusList1", constructionStatus1);
        map.put("constructionStatusList2", constructionStatus2);
        return map;
    }

    /**
     * 开启自动充电（二期）
     * gbq
     */
    @GetMapping("/goCharge")
    @ResponseBody
    @ApiOperation(value = "开启自动充电", notes = "开启自动充电（二期）")
    public String goCharge() {
        String value = Constants.doGet(Constants.goCharge);
        return value;
    }

    /**
     * 关闭自动充电（二期）
     * gbq
     */
    @GetMapping("/stopCharge")
    @ResponseBody
    @ApiOperation(value = "关闭自动充电", notes = "关闭自动充电（二期）")
    public String stopCharge() {
        String value = Constants.doGet(Constants.stopCharge);
        return value;
    }

    /**
     * 启动调度导航（二期）
     * gbq
     */
    @GetMapping("/startScheduleMode")
    @ResponseBody
    @ApiOperation(value = "启动调度导航", notes = "启动调度导航（二期）")
    public String startScheduleMode() {
        String value = Constants.doGet(Constants.startScheduleMode);
        return value;
    }

    /**
     * 开启导航（二期）
     * gbq
     */
    @GetMapping("/start")
    @ResponseBody
    @ApiOperation(value = "开启导航", notes = "开启（二期）")
    public String start(@RequestParam(required = false) String map,
                        @RequestParam(required = false) String path,
                        @RequestParam(required = false) Integer start_index) {
        String value = Constants.doGet(Constants.start + "?map" + map + "&path" + path + "&start_index" + start_index);
        return value;
    }

    /**
     * 关闭导航（二期）
     * gbq
     */
    @GetMapping("/stop")
    @ResponseBody
    @ApiOperation(value = "关闭导航", notes = "关闭（二期）")
    public String stop() {
        String value = Constants.doGet(Constants.stop);
        return value;
    }

    /**
     * 停止调度导航（二期）
     * gbq
     */
    @GetMapping("/stopScheduleMode")
    @ResponseBody
    @ApiOperation(value = "停止调度导航", notes = "停止调度导航（二期）")
    public String stopScheduleMode() {
        String value = Constants.doGet(Constants.stopScheduleMode);
        return value;
    }

    /**
     * 开启导航任务（二期）
     * gbq
     */
    @GetMapping("/startNavTask")
    @ResponseBody
    @ApiOperation(value = "开启导航任务", notes = "开启导航任务（二期）")
    public String startNavTask(@RequestParam float x,
                               @RequestParam float y,
                               @RequestParam float theta,
                               @RequestParam String map,
                               @RequestParam String path) {
        String value = Constants.doGet(Constants.startNavTask + "?x" + x + "&y" + y + "&theta" + theta + "&map" + map + "&path" + path);
        return value;
    }

    /**
     * 取消当前导航任务（二期）
     * gbq
     */
    @GetMapping("/stopNavTask")
    @ResponseBody
    @ApiOperation(value = "取消当前导航任务", notes = "取消当前导航任务（二期）")
    public String stopNavTask() {
        String value = Constants.doGet(Constants.stopNavTask);
        return value;
    }

    /**
     * 获取导航地图（二期）
     * gbq
     */
    @GetMapping("/getNavMap")
    @ResponseBody
    @ApiOperation(value = "导航地图", notes = "导航地图（二期）")
    public HashMap<String, Object> getNavMap() {
        HashMap<String, Object> map = new HashMap<>();
        String value = Constants.doGet(Constants.navMap);
        JSONObject jsonObject = JSON.parseObject(value);
        String Map = String.valueOf(jsonObject.get("map"));
        String Path = String.valueOf(jsonObject.get("path"));
        map.put("map", Map);
        map.put("path", Path);
        return map;
    }

    /**
     * 运行日志（二期）
     * gbq
     */
    @GetMapping("/getLog")
    @ResponseBody
    @ApiOperation(value = "运行日志", notes = "地盘日志（二期）")
    public HashMap<String, Object> getLog() {
        HashMap<String, Object> map = new HashMap<>();
        String value = Constants.doGet(Constants.log);
        JSONObject jsonObject = JSON.parseObject(value);
        String Log = String.valueOf(jsonObject.get("log"));
        map.put("log", Log);
        return map;
    }

    /**
     * 按条件查找主控项目，二级联动
     * gbq
     */
    @GetMapping("/selectProject")
    @ResponseBody
    @ApiOperation(value = "二级联动", notes = "二级联动")
    public List<Map<String,Object>> selectProject(@RequestParam Integer value) {
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> map;
        switch (value) {
            case 0:
                map = new HashMap<>();
                map.put("des","隧道开挖轮廓");
                map.put("con","隧道开挖轮廓尺寸应符合设计要求,并应控制超欠挖,围岩完整石质坚硬岩石个别突出部位最大欠挖值不大于50 mm,且每1 立方米不大于0.1 立方米。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","开挖隧底地质描述");
                map.put("con","隧底开挖后应对地质情况进行确认,有地基承载力设计要求时应符合设计要求。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","岩溶隧道隧底情况");
                map.put("con","岩溶隧道应按设计要求对隧底情况进行探测。岩溶发育段每不大于12 m检查一次");
                list.add(map);
                break;
            case 1:
                map = new HashMap<>();
                map.put("des","管棚钢管信息");
                map.put("con","管棚所用钢管的种类,规格和长度应符合设计要求。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","管棚施作信息");
                map.put("con","管棚施作位置、搭接长度和数量应符合设计要求。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","超前小导管种类、规格、长度要求");
                map.put("con","超前小导管的种类、规格和长度应符合设计要求。每循环检验3根");
                list.add(map);
                map = new HashMap<>();
                map.put("des","超前小导管位置、搭接长度、数量要求");
                map.put("con","超前小导管的位置、搭接长度和数量应符合设计要求。每循环位置、搭接长度检验3根。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","水平旋喷桩状态");
                map.put("con","水平旋喷桩的数量,桩长,桩径、桩间距等应符合设计要求并每循环检验3根。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","喷射混凝土状态");
                map.put("con","喷射混凝土平均厚度应符合设计要求,检查点数90%及以上应不小于设计厚度。全断面开挖时,每一作业循环检验一次;分部开挖时,按每3 m~～5 m检验一次。\n");
                list.add(map);
                map = new HashMap<>();
                map.put("des","锚杆安装");
                map.put("con","锚杆安装的数量应符合设计要求。施工、监理单位要全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","钢架安装");
                map.put("con","钢架应及时架设,钢架安装不得侵入二次衬酥结构,锁脚锚管(杆)、相邻钢架及各节钢架间的连接应符合设计要求。施工、监理单位全数检查。");
                list.add(map);
                break;
            case 2:
                map = new HashMap<>();
                map.put("des","仰拱（底板）施作前检查");
                map.put("con","仰拱(底板)施作前隧底应无虚渣,淤泥、积水和杂物。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","仰拱（底板）与填充混凝土状态");
                map.put("con","仰拱(底板)和填充混凝土厚度应符合设计要求。检验数量:同一围岩浇筑段检验不少于2个横断面");
                list.add(map);
                map = new HashMap<>();
                map.put("des","接触网槽道");
                map.put("con","接触网槽道安装应符合设计要求,距离施工缝不应小于l m。应全数检查");
                list.add(map);
                break;
            case 3:
                map = new HashMap<>();
                map.put("des","排水沟槽身");
                map.put("con","排水沟槽身的钢筋规格、数量及安装应符合设计要求。每一浇筑段检验连续2m");
                list.add(map);
                map = new HashMap<>();
                map.put("des","保温沟");
                map.put("con","保温沟的安装和回填应符合设计要求。施工、监理单位全数检查");
                list.add(map);
                map = new HashMap<>();
                map.put("des","排水系统");
                map.put("con","盲管、水沟和孔槽组成的排水系统应有良好的排水效果，洞内排水顺畅,无积淤堵塞。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","检查井井身");
                map.put("con","检查井井身钢筋规格、数量和安装应符合设计要求。施工、监理单位全部检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","盲管铺设");
                map.put("con","盲管铺设位置和范围应符合设计要求,且不应低于隧道水沟底面高程;盲管固定应牢固、平顺。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","排水盲管连接");
                map.put("con","排水盲管之间的连接、盲管与排水沟的连接应符合设计要求,无堵塞,连接应牢固。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","隧底深埋排水沟");
                map.put("con","隧底深埋排水沟排水应通畅、无堵塞。检验数量。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","隧道衬砌混凝土施工缝防水构造");
                map.put("con","隧道衬砌混凝土施工缝防水构造形式应符合设计要求。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","止水带（条）安装");
                map.put("con","止水带(条)的安装应符合下列规定:1中埋式止水带位置距离衬砌内表面不应小于200 mm,径向位置允许偏差20 mm,埋深允许偏差为士30 mm。止水带连接应符合设计要求,接缝平整、牢固,不得有裂口和脱胶现象。3背贴式止水带与防水板应粘贴密贴。4止水条的设置应符合设计要求,搭接长度不应小于50 mm。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","变形缝嵌填");
                map.put("con","变形缝的位置、宽度和构造形式,嵌缝材料的品种、规格应符合设计要求。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","铺设防（排）水层");
                map.put("con","铺设防(排)水层的基面应平整、无尖锐物体、无股状流水。施工、监理单位全数检查");
                list.add(map);
                map = new HashMap<>();
                map.put("des","防水层铺设");
                map.put("con","防水层铺设质量应符合下列规定:1防水层铺设应与基层密贴、平整,无褶皱、无塌落、无破损。2防水板的搭接宽度不应小于150 mm。3防水板焊接采用双缝焊接,每条焊缝有效宽度不应小于15 mm,无漏焊、假焊﹑焊焦,焊穿。4采用固定点铺设的防水板,固定点间距拱部宜为0.5 m～0.8 m,边墙宜为0.8 m～1.0 m。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","沥青防水卷材");
                map.put("con","沥青防水卷材等应符合设计及《地下防水工程质量验收规范》GB 50208相关要求。施工、监理单位全数检查。");
                list.add(map);
                map = new HashMap<>();
                map.put("des","喷涂防水层");
                map.put("con","喷涂防水层基面应干燥,喷涂均匀,无漏喷、无空鼓。施工、监理单位全数检查。");
                list.add(map);
                break;
            case 4:
                map = new HashMap<>();
                map.put("des","电缆槽身");
                map.put("con","电缆槽身的钢筋规格、数量及安装应符合设计要求。每一浇筑段检验连续2 m");
                list.add(map);
                break;
            case 5:
                map = new HashMap<>();
                map.put("des","仰拱预制块安装前检查");
                map.put("con","TBM隧道仰拱预制块安装前,隧底应清理干净,无积水，无虚渣。仰拱预制块与围岩之间应使用垫块进行支垫,间隙符合设计要求。施工、监理单位全数检查。");
                list.add(map);
                break;
            case 6:
                map = new HashMap<>();
                map.put("des","防排水质量合格标准");
                map.put("con","防排水质量合格标准应符合下列规定:1正洞和设备洞室衬砌不渗水,道床无积水,设备安装孔眼不渗水,泄水孔排水畅通。2洞内外水沟流水坡面平顺,水流畅通,不淤积堵塞,保温措施满足设计要求。3泄水孔、泄水洞排水顺畅,无淤积。全数检查。");
                list.add(map);
                break;
        }
        return list;

    }
}